﻿Imports Phila
Imports Phila.Sql
Imports Phila.CommonClasses
Imports System.IO
Imports System.Xml
Imports Telerik.WebControls

Public Class ViewCountry
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim strSql As String
        strSql = "select * from ptn_Countries order by Id desc"
        'Fill_Grid_Bind(gvCountry, strSql)
        'If Not IsPostBack Then
        '    Response.Write(GetCountries())
        'End If
        'GetCountries()
        Fill_Grid(radGrid, strSql)
    End Sub

    'Public Shared Function GetCountries() As String
    '    Dim query As String = "SELECT * FROM ptn_Countries"
    '    ' Populate the DataSet.
    '    Dim data As DataSet = getdataset(query)
    '    ' return the Customers table as XML.
    '    Dim writer As New System.IO.StringWriter()
    '    'data.Tables(0).WriteXml(writer, XmlWriteMode.WriteSchema, False)
    '    data.Tables(0).WriteXml(writer, False)
    '    MsgBox("'" & writer.ToString() & "'")
    '    Return "'" & writer.ToString() & "'"
    '    'Return getjQgridData("select * from ptn_Countries order by Id desc", "4").ToString
    '    ' Return get_json()

    'End Function


    'Private Sub gvCountry_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles gvCountry.RowEditing
    '    'Dim userID As Label = DirectCast(gvCountry.Rows(e.RowIndex).FindControl("Id"), Label)
    '    Dim CId As Integer = gvCountry.Rows(e.NewEditIndex).Cells(0).Text
    '    Response.Redirect("EditCountry.aspx?cid=" & CId)
    'End Sub

    'Private Sub radGrid_DeleteCommand(ByVal source As Object, ByVal e As Telerik.WebControls.GridCommandEventArgs) Handles radGrid.DeleteCommand
    '    Dim ID As String = (CType(e.Item, GridDataItem)).OwnerTableView.DataKeyValues(e.Item.ItemIndex)("ID").ToString
    '    Try
    '        Dim txt As Array
    '        Dim strSql As String
    '        strSql = "select t.* from ptn_Tours t inner join ptn_CatZoneTours ct on t.id=ct.tourid"
    '        txt = RetriveData(strSql, 0)
    '        If txt(0) Then

    '        End If
    '        'Dim txt As Array
    '        Dim sqlGal, sqlGalType As String
    '        sqlGal = "delete from ptn_Countries where Id=" & ID
    '        If LCase(Request.QueryString("type")) = "t" Then
    '            sqlGalType = "delete from ptn_tourgallery where GalleryId=" & ID
    '        Else
    '            sqlGalType = "delete from ptn_hotelgallery where GalleryId=" & ID
    '        End If
    '        Insert_Update_Delete_Record(sqlGal)
    '        Insert_Update_Delete_Record(sqlGalType)
    '        bindGridView(radGrid)
    '        'txt = RetriveData("select Thumbnail, Image from ptn_gallery where Id=" & ID, 1)
    '        'System.IO.File.Delete(Server.MapPath("~/images/img" & txt(0)))
    '        'System.IO.File.Delete(Server.MapPath("~/images/img" & txt(1)))
    '    Catch ex As Exception
    '        'radGrid.Controls.Add(New LiteralControl(("Unable to Delete Record. Reason: " + ex.Message)))
    '        lblError.Text = "Unable to Delete Record. Reason: " + ex.Message
    '        lblError.ForeColor = Drawing.Color.Red
    '        e.Canceled = True
    '    End Try
    'End Sub

End Class